import request from '@/utils/request'
import { ConfigList, QuestionConfig, QuestionConfigSearch } from '@/model/business/questionscommon/questionconfig/model'

export function saveQuestionConfig (data: QuestionConfig) {
  return request({
    url: '/questions/common/config/save',
    data: data,
    method: 'post'
  })
}

export function removeQuestionSub (id: string) {
  return request({
    url: `/questions/common/config/deleteSub?subId=${id}`,
    method: 'post'
  })
}

export function getQuestionConfigList (data: QuestionConfigSearch) {
  return request<ConfigList>({
    url: '/questions/common/config/list',
    data: data,
    method: 'post'
  })
}

export function removeQuestionConfig (id: string) {
  return request({
    url: `/questions/common/config/delRecord?id=${id}`,
    method: 'post'
  })
}

export function getQuestionConfig (id: string) {
  return request({
    url: `/questions/common/config/data?id=${id}`,
    method: 'get'
  })
}

export function publishQuestion (id: string, type: string) {
  return request({
    url: `/questions/common/config/publish?id=${id}&type=${type}`,
    method: 'post'
  })
}
